/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.brainy.perseu.manegerworker.facades;

import br.com.brainy.perseu.manegerworker.bean.Pessoa;
import br.com.brainy.perseu.generic.exeptions.BankException;
import br.com.brainy.perseu.manegerworker.factories.Factory;
import br.com.brainy.perseu.generic.interfaces.IGenericDAO;
import br.com.brainy.perseu.manegerworker.interfaces.IFactory;
import br.com.brainy.perseu.manegerworker.interfaces.IUniqueFacadeWorker;
import java.util.List;

/**
 *
 * @author Luiz Segundo
 */
public class UniqueFacadeWorker implements IUniqueFacadeWorker{
        
        IFactory factory = new Factory();
        IGenericDAO dao = factory.getNewPessoaDAO();

        @Override
        public boolean addPessoa(Pessoa p) throws BankException {
                return dao.addObject(p);
        }

        @Override
        public boolean removePessoa(Pessoa p) throws BankException {
                return dao.removeObject(p);
        }

        @Override
        public boolean updatePessoa(Pessoa p) throws BankException {
                return dao.updateObject(p);
        }

        @Override
        public List<Pessoa> searchForName(String name) throws BankException{
                return dao.searchObjectForName(name);
        }

        @Override
        public Pessoa searchObjectForNameLastName(String name, String lastName) throws BankException{
                return (Pessoa) dao.searchObjectForNameLastName(name, lastName);
        }

        @Override
        public List<Pessoa> listAll(){
                return dao.listAll();
        }
        
}
